<div class="col-md-4">
    <form id="add_good_form">
    <table class="table table-condensed table-responsive table-hover table-striped table-bordered">
        <tr>
            <td>套餐类型</td>
            <td>
                <select name="class">
                    <option value="1">普通套餐</option>
                    <option value="2">体验套餐</option>
                </select>
            </td>
        </tr>
        <tr>
            <td>套餐名称</td>
            <td>
                <input type="text" name="name">
            </td>
        </tr>
        <tr>
            <td>套餐价格</td>
            <td>
                <input type="text" name="price">
            </td>
        </tr>
        <tr>
            <td>优惠1</td>
            <td>
                <input type="text" name="nice1">
            </td>
        </tr>
        <tr>
            <td>优惠2</td>
            <td>
                <input type="text" name="nice2">
            </td>
        </tr>
        <tr>
            <td>是否启用</td>
            <td>
                启用<input type="radio" checked="checked" name="status" value="1">
                禁用<input type="radio" name="status" value="0">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <input type="button" id="add_good_submit" value="提交">
            </td>
        </tr>
    </table>
    </form>
</div>
<script>
    $(document).ready(function () {
        $("#add_good_submit").click(function () {
            var data = $("#add_good_form").serialize();
            console.log(typeof data,data);
            $.ajax({
                url: "/admin.php/Good/addGood",
                method: "post",
                data: data,
                dataType: 'json',
                success: function (res) {
                    if (res.code == 200) {
                        alert("添加成功");
                        window.location.href = "/admin.php/good/index";
                    } else {
                        alert("添加失败");
                    }
                }
            });
        });
    });
</script>